
export { };

// 3.透明单例模式：客户端或则使用者不需要直到单例的具体实现
let Window = (function () {
  let instance3: Window;
  let Window = function (this: Window) {
    if (!instance3) {
      console.log('3 没有走缓存');
      return instance3 = this;
    };
    console.log('3 走缓存');
    return instance3
  };
  return Window

})();
//3 测试单例
// new (Window as any)().hello();
let w1 = new (Window as any)();
let w2 = new (Window as any)();
console.log(`3 两个实例是否一样${w1 == w2}`)
